<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/sys/css.jsp"%>



<html lang="zh-cmn-Hans">
<head>
    <title></title>
    <style>
        .layui-input-inline {
            width: 100%;
        }

    </style>
</head>
    
    <body>
    <div class="layui-field-box">
        <form class="layui-form layui-form-pane">
            <table class="viewTable">
                <tr>
                    <th style="height: 55px">登录名</th>
                    <td >
                            <input id="userCode" class="layui-input" value="${user.userInfo.userCode}" name="userCode" type="hidden">
                            <input type="hidden" name="isValid" id="isValid" class="layui-input" value="${user.userInfo.isValid}"/>
                            <div class="layui-input-inline">
                            <input name="loginName" id="loginName" class="layui-input" type="text"  autocomplete="off" value="${user.userInfo.loginName}" disabled>
                        </div>
                            
                    </td>
                </tr>
                  <tr>
                    <th>用户名</th>
                    <td >
                        <div class="layui-input-inline">
                            <input name="userName" id="userName" class="layui-input" type="text" placeholder="请输入用户名" autocomplete="off" value="${user.userInfo.userName}" lay-verify="required">
                        </div>
                    </td>
                </tr>
                  <tr>
                      <th>原密码</th>
                      <td >
                          <div class="layui-input-inline">
                              <input name="userPin" id="userPin" class="layui-input" type="password" placeholder="请输入密码" autocomplete="off" lay-verify="required|pass">
                          </div>
                      </td>
                  </tr>
                  <tr>
                      <th>新密码</th>
                      <td >
                          <div class="layui-input-inline">
                              <input name="newpassword" id="newpassword" class="layui-input" type="password" placeholder="请输入密码" autocomplete="off" lay-verify="required|pass">
                          </div>
                      </td>
                  </tr>
                  <tr>
                      <th>确认密码</th>
                      <td >
                          <div class="layui-input-inline">
                              <input name="newpassword2" class="layui-input" type="password" placeholder="请输入密码" autocomplete="off" lay-verify="required|resspaword">
                          </div>
                      </td>
                  </tr>
            </table>
            
             <div style="text-align: center;margin-top: 20px" >
		      	 <button class="layui-btn" lay-submit="" lay-filter="formAdd">确定</button>
		      	 <button class="layui-btn" onclick="CloseWin()">关闭</button>
		    </div>
        </form>
    </div>

  </body>
    	
    	
<script>

var basePath= "${pageContext.request.contextPath}";


layui.config({
	base : "/dhjdglxt/modules/util/"//自定义加载的模块
}).use(['form','layer'],function(){
	var form = layui.form,
	layer = parent.layer === undefined ? layui.layer : parent.layer;
	 //监听提交
        form.on('submit(formAdd)', function(data){
	    $.ajax({
	        type: "POST",
	        url: "${cp:SYS_VALUE('app.staticfile.home')}/system/layui/update",
	        data:data.field,
	        async:false,
	        success: function(data){
	        	if(data.data.code=='T'){
                    layer.alert(data.data.message,{offset: '100px',icon: 1},function () {
                        window.parent.location.reload();
                        var index =layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        layer.close(index); //再执行关闭
                        layer.closeAll();
                    });
	    		}else {
                    layer.alert(data.data.message,{offset: '100px',icon: 0});
	    		}
//	        	parent.parent.location.reload();	
	          },
            error:function () {
                layer.alert("执行错误",{offset: '100px',icon: 0});
            }
	    });
	  });
    form.verify({
        resspaword:function(value){
            var pass = $('#newpassword').val();
            if(value != pass){
                return '两次密码不一致';
            }
        }

    });
    
    $.ajax({
        type: "GET",
        url: "${cp:SYS_VALUE('app.staticfile.home')}/system/layui/goEdit",
 //       url: window.ViewContextPath+"system/layui/goEdit",
        async:false,
        dataType: "json",
        success: function(data){
        	var main = data.data.userInfo;
        	
        	$("#userCode").val(main.userCode);
        	$("#isValid").val(main.isValid);
        	$("#loginName").val(main.loginName);

			$("#userName").val(main.userName);
			$("#userPin").val(main.userPin);
			
        	form.render();
          }
    }); 
})
</script>
</html>

